/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package slcu.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import slcu.model.PruebaDisciplina;
import slcu.model.PruebaDisciplinaModel;

import java.io.Serializable;

import java.sql.Types;

import java.util.HashMap;
import java.util.Map;

/**
 * The base model implementation for the PruebaDisciplina service. Represents a row in the &quot;SLCU_PruebaDisciplinas&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link slcu.model.PruebaDisciplinaModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link PruebaDisciplinaImpl}.
 * </p>
 *
 * @author tito
 * @see PruebaDisciplinaImpl
 * @see slcu.model.PruebaDisciplina
 * @see slcu.model.PruebaDisciplinaModel
 * @generated
 */
public class PruebaDisciplinaModelImpl extends BaseModelImpl<PruebaDisciplina>
	implements PruebaDisciplinaModel {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. All methods that expect a PruebaDisciplinas model instance should use the {@link slcu.model.PruebaDisciplina} interface instead.
	 */
	public static final String TABLE_NAME = "SLCU_PruebaDisciplinas";
	public static final Object[][] TABLE_COLUMNS = {
			{ "pruebaId", Types.BIGINT },
			{ "disciplinaId", Types.BIGINT },
			{ "nombre", Types.VARCHAR },
			{ "orden", Types.BIGINT },
			{ "categorias", Types.VARCHAR }
		};
	public static final String TABLE_SQL_CREATE = "create table SLCU_PruebaDisciplinas (pruebaId LONG not null primary key,disciplinaId LONG,nombre VARCHAR(75) null,orden LONG,categorias VARCHAR(75) null)";
	public static final String TABLE_SQL_DROP = "drop table SLCU_PruebaDisciplinas";
	public static final String ORDER_BY_JPQL = " ORDER BY pruebaDisciplina.orden ASC";
	public static final String ORDER_BY_SQL = " ORDER BY SLCU_PruebaDisciplinas.orden ASC";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.slcu.model.PruebaDisciplina"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.slcu.model.PruebaDisciplina"),
			true);
	public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.column.bitmask.enabled.slcu.model.PruebaDisciplina"),
			true);
	public static long DISCIPLINAID_COLUMN_BITMASK = 1L;
	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.slcu.model.PruebaDisciplina"));

	public PruebaDisciplinaModelImpl() {
	}

	public long getPrimaryKey() {
		return _pruebaId;
	}

	public void setPrimaryKey(long primaryKey) {
		setPruebaId(primaryKey);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_pruebaId);
	}

	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey(((Long)primaryKeyObj).longValue());
	}

	public Class<?> getModelClass() {
		return PruebaDisciplina.class;
	}

	public String getModelClassName() {
		return PruebaDisciplina.class.getName();
	}

	@Override
	public Map<String, Object> getModelAttributes() {
		Map<String, Object> attributes = new HashMap<String, Object>();

		attributes.put("pruebaId", getPruebaId());
		attributes.put("disciplinaId", getDisciplinaId());
		attributes.put("nombre", getNombre());
		attributes.put("orden", getOrden());
		attributes.put("categorias", getCategorias());

		return attributes;
	}

	@Override
	public void setModelAttributes(Map<String, Object> attributes) {
		Long pruebaId = (Long)attributes.get("pruebaId");

		if (pruebaId != null) {
			setPruebaId(pruebaId);
		}

		Long disciplinaId = (Long)attributes.get("disciplinaId");

		if (disciplinaId != null) {
			setDisciplinaId(disciplinaId);
		}

		String nombre = (String)attributes.get("nombre");

		if (nombre != null) {
			setNombre(nombre);
		}

		Long orden = (Long)attributes.get("orden");

		if (orden != null) {
			setOrden(orden);
		}

		String categorias = (String)attributes.get("categorias");

		if (categorias != null) {
			setCategorias(categorias);
		}
	}

	public long getPruebaId() {
		return _pruebaId;
	}

	public void setPruebaId(long pruebaId) {
		_pruebaId = pruebaId;
	}

	public long getDisciplinaId() {
		return _disciplinaId;
	}

	public void setDisciplinaId(long disciplinaId) {
		_columnBitmask |= DISCIPLINAID_COLUMN_BITMASK;

		if (!_setOriginalDisciplinaId) {
			_setOriginalDisciplinaId = true;

			_originalDisciplinaId = _disciplinaId;
		}

		_disciplinaId = disciplinaId;
	}

	public long getOriginalDisciplinaId() {
		return _originalDisciplinaId;
	}

	public String getNombre() {
		if (_nombre == null) {
			return StringPool.BLANK;
		}
		else {
			return _nombre;
		}
	}

	public void setNombre(String nombre) {
		_nombre = nombre;
	}

	public long getOrden() {
		return _orden;
	}

	public void setOrden(long orden) {
		_columnBitmask = -1L;

		_orden = orden;
	}

	public String getCategorias() {
		if (_categorias == null) {
			return StringPool.BLANK;
		}
		else {
			return _categorias;
		}
	}

	public void setCategorias(String categorias) {
		_categorias = categorias;
	}

	public long getColumnBitmask() {
		return _columnBitmask;
	}

	@Override
	public ExpandoBridge getExpandoBridge() {
		return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
			PruebaDisciplina.class.getName(), getPrimaryKey());
	}

	@Override
	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		ExpandoBridge expandoBridge = getExpandoBridge();

		expandoBridge.setAttributes(serviceContext);
	}

	@Override
	public PruebaDisciplina toEscapedModel() {
		if (_escapedModelProxy == null) {
			_escapedModelProxy = (PruebaDisciplina)ProxyUtil.newProxyInstance(_classLoader,
					_escapedModelProxyInterfaces,
					new AutoEscapeBeanHandler(this));
		}

		return _escapedModelProxy;
	}

	@Override
	public Object clone() {
		PruebaDisciplinaImpl pruebaDisciplinaImpl = new PruebaDisciplinaImpl();

		pruebaDisciplinaImpl.setPruebaId(getPruebaId());
		pruebaDisciplinaImpl.setDisciplinaId(getDisciplinaId());
		pruebaDisciplinaImpl.setNombre(getNombre());
		pruebaDisciplinaImpl.setOrden(getOrden());
		pruebaDisciplinaImpl.setCategorias(getCategorias());

		pruebaDisciplinaImpl.resetOriginalValues();

		return pruebaDisciplinaImpl;
	}

	public int compareTo(PruebaDisciplina pruebaDisciplina) {
		int value = 0;

		if (getOrden() < pruebaDisciplina.getOrden()) {
			value = -1;
		}
		else if (getOrden() > pruebaDisciplina.getOrden()) {
			value = 1;
		}
		else {
			value = 0;
		}

		if (value != 0) {
			return value;
		}

		return 0;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		PruebaDisciplina pruebaDisciplina = null;

		try {
			pruebaDisciplina = (PruebaDisciplina)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long primaryKey = pruebaDisciplina.getPrimaryKey();

		if (getPrimaryKey() == primaryKey) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (int)getPrimaryKey();
	}

	@Override
	public void resetOriginalValues() {
		PruebaDisciplinaModelImpl pruebaDisciplinaModelImpl = this;

		pruebaDisciplinaModelImpl._originalDisciplinaId = pruebaDisciplinaModelImpl._disciplinaId;

		pruebaDisciplinaModelImpl._setOriginalDisciplinaId = false;

		pruebaDisciplinaModelImpl._columnBitmask = 0;
	}

	@Override
	public CacheModel<PruebaDisciplina> toCacheModel() {
		PruebaDisciplinaCacheModel pruebaDisciplinaCacheModel = new PruebaDisciplinaCacheModel();

		pruebaDisciplinaCacheModel.pruebaId = getPruebaId();

		pruebaDisciplinaCacheModel.disciplinaId = getDisciplinaId();

		pruebaDisciplinaCacheModel.nombre = getNombre();

		String nombre = pruebaDisciplinaCacheModel.nombre;

		if ((nombre != null) && (nombre.length() == 0)) {
			pruebaDisciplinaCacheModel.nombre = null;
		}

		pruebaDisciplinaCacheModel.orden = getOrden();

		pruebaDisciplinaCacheModel.categorias = getCategorias();

		String categorias = pruebaDisciplinaCacheModel.categorias;

		if ((categorias != null) && (categorias.length() == 0)) {
			pruebaDisciplinaCacheModel.categorias = null;
		}

		return pruebaDisciplinaCacheModel;
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(11);

		sb.append("{pruebaId=");
		sb.append(getPruebaId());
		sb.append(", disciplinaId=");
		sb.append(getDisciplinaId());
		sb.append(", nombre=");
		sb.append(getNombre());
		sb.append(", orden=");
		sb.append(getOrden());
		sb.append(", categorias=");
		sb.append(getCategorias());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(19);

		sb.append("<model><model-name>");
		sb.append("slcu.model.PruebaDisciplina");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>pruebaId</column-name><column-value><![CDATA[");
		sb.append(getPruebaId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>disciplinaId</column-name><column-value><![CDATA[");
		sb.append(getDisciplinaId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>nombre</column-name><column-value><![CDATA[");
		sb.append(getNombre());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>orden</column-name><column-value><![CDATA[");
		sb.append(getOrden());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>categorias</column-name><column-value><![CDATA[");
		sb.append(getCategorias());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private static ClassLoader _classLoader = PruebaDisciplina.class.getClassLoader();
	private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
			PruebaDisciplina.class
		};
	private long _pruebaId;
	private long _disciplinaId;
	private long _originalDisciplinaId;
	private boolean _setOriginalDisciplinaId;
	private String _nombre;
	private long _orden;
	private String _categorias;
	private long _columnBitmask;
	private PruebaDisciplina _escapedModelProxy;
}